home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig15_11.jar
/
Ch15
/
Fig15_11
/
QUEUE
/
Driver.cpp
next >
Wrap
C/C++ Source or Header
|
1997-11-04
|
1KB
|
52 lines
// Queue test program
#include <iostream.h>
#include "queue.h"
int main()
{
Queue<int> intQueue;
cout << "Inserting integers on intQueue" << endl;
for ( int i = 0; i < 5; i++ ) {
intQueue.enqueue( i ); // put items in the queue
cout << i << ' ';
}
cout << endl;
intQueue.print(); // output the queue contents
cout << endl << "Deleting integers from intQueue" << endl;
while ( !intQueue.isEmpty() )
cout << intQueue.dequeue() << ' '; // remove items
cout << endl;
intQueue.print(); // output the queue contents
Queue<char> charQueue;
cout << endl << endl
<< "Inserting characters on charQueue" << endl;
for ( char c = 'A'; c < 'E'; c++ ) {
charQueue.enqueue( c ); // put items in the queue
cout << c << ' ';
}
cout << endl;
charQueue.print(); // output the queue contents
cout << endl << "Deleting characters from charQueue" << endl;
while ( !charQueue.isEmpty() )
cout << charQueue.dequeue() << ' '; // remove items
cout << endl;
charQueue.print(); // output the queue contents
return 0;
}